<?php
 
// No direct access
defined('_JEXEC') or die('Restricted access'); 
?>
<?php // echo $this->greeting; ?>
<h1 style='color:#0F6EAC;'>Online Member Database</h1>
<p style='text-align:right;'><A href='http://www.indescon.org/index.php/membership-mainmenu-6/membership-form.html'>Apply here for membership</A></p>

<table width="100%" border="0">
<?php
    $members    = $this->members;

    $my_date       = date("d M, Y (D)");
    $member_count  = 0;

    foreach ($members as $member)
    {
        // echo "_id: " . $member->id . "<br/>";

        $all_fields	= preg_split("/\|\|/", $member->params);

        $company_name	= $all_fields[0];
        $company_name	= preg_replace('/CompanyName=/', '', $company_name);

        $contact_person	= $all_fields[1];
        $contact_person	= preg_replace('/ContactPerson=/', '', $contact_person);

        $contact_email	= $all_fields[2];
        $contact_email	= preg_replace('/ContactEmail=/', '', $contact_email);

        $phone_number	= $all_fields[3];
        $phone_number	= preg_replace('/PhoneNumber=/', '', $phone_number);

        $url	        = preg_replace('/http\:\/\//', '', $all_fields[4]);
        $url	        = preg_replace('/InternetURL=/', '', $url);

        $certifications	= $all_fields[5];
        $certifications	= preg_replace('/CertificationsandAffiliations=/', '', $certifications);

        $profile	= $all_fields[9];
        $profile	= preg_replace('/CompanyProfile=/', '', $profile);

        // echo "<p>C_Name = " . $company_name . " - " . $fifth_choice . "<p>";
        echo "<tr style='border-top: 1px solid #ededed;'>
                <td style='vertical-align:top'>$member->id</td>
                <td style='vertical-align:top'><a href='http://$url' target=_>$company_name</a></td>
                <td style='vertical-align:top'>
                    <a href='mailto:$contact_email'>$contact_person</a>
                    <p style='font-size:10px;'>
                    Phone: $phone_number
                    </p>
                </td>
                <td style='vertical-align:top'>
                    $certifications<br>
                ";
        if (trim($profile) != '') 
        echo "<a href='$profile' style='text-decoration:none;'><font size=1>Download Corporate Profile</font></a>";

        echo "</td></tr>"; 
        $member_count++;
    }
    echo "<tr style='border-top: 1px solid #ededed;'><td colspan=4><i>Updated $my_date</i> - $member_count members found.</td></tr>";
?>
</table>